package me.firstapp.module.shop;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import me.firstapp.module.base.BaseEntity;

@Entity
@Table(name = "SHOPPING_CART_ITEM")
public class ShoppingCartItem extends BaseEntity {

	private static final long serialVersionUID = 5981457974044323762L;

	// 关联的购物车
	@Column(name = "SHOPPING_CART_ID", nullable = false)
	private Long shoppingCartId;

	// 关联的商品
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PRODUCT_ID", referencedColumnName = "ID", nullable = false)
	private Product product;

	// 关联的sku
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PRODUCT_SKU_REL_ID", referencedColumnName = "ID", nullable = false)
	private ProductSkuRelation productSkuRelation;

	// 商品数量
	@Column(name = "COUNTS", nullable = false)
	private Integer counts;

	// 商品总价
	@Column(name = "VALUE", columnDefinition = "DECIMAL(11, 2)", nullable = false)
	private Double value;

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Integer getCounts() {
		return counts;
	}

	public void setCounts(Integer counts) {
		this.counts = counts;
	}

	public Double getValue() {
		return value;
	}

	public void setValue(Double value) {
		this.value = value;
	}

	public Long getShoppingCartId() {
		return shoppingCartId;
	}

	public void setShoppingCartId(Long shoppingCartId) {
		this.shoppingCartId = shoppingCartId;
	}

	public ProductSkuRelation getProductSkuRelation() {
		return productSkuRelation;
	}

	public void setProductSkuRelation(ProductSkuRelation productSkuRelation) {
		this.productSkuRelation = productSkuRelation;
	}

}
